package diwuzhang;

/**
 * Created by mc on 2016/7/25.
 */

public class shisan
{
    public static void qingkong(int q[][])
    {
        q[8][8]={{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0}};
        return 0;
    }

    public static void tianchong(int q[][],int a,int b)
    {
        int c,d,e;
        c=a;
        d=b;
        q[0][b]=1;
        q[1][b]=1;
        q[2][b]=1;
        q[4][b]=1;
        q[5][b]=1;
        q[6][b]=1;
        q[3][b]=1;
        q[7][b]=1;
        q[a][0]=1;
        q[a][1]=1;
        q[a][2]=1;
        q[a][3]=1;
        q[a][4]=1;
        q[a][5]=1;
        q[a][6]=1;
        q[a][7]=1;
        while(c<=8&&d<=8&&c>=0&&d>=0)
        {
            c=c-1;
            d=d-1;
            q[c][d]=1;
        }
        c=a;
        d=b;
        while(c<=8&&d<=8&&c>=0&&d>=0)
        {
            c=c-1;
            d=d+1;
            q[c][d]=1;
        }
        c=a;
        d=b;
        while(c<=8&&d<=8&&c>=0&&d>=0)
        {
            c=c+1;
            d=d-1;
            q[c][d]=1;
        }
        c=a;
        d=b;
        while(c<=8&&d<=8&&c>=0&&d>=0)
        {
            c=c+1;
            d=d+1;
            q[c][d]=1;
        }
        return;


    }
    public static void main(String[] arge) {
        int q[][] = new int[8][8];
        int a, b, c, d, e, f;
        c = 0;
        d = 0;
        e = 0;
        f = 0;
        b = e;
        while (b < 8) {
            c = 0;
            for (a = d; a < 8 && c == 0; a = a + 1) {
                if (q[a][b] == 0) {
                    tianchong(q[][],a, b);
                    c = 1;
                }
            }
            if (q[0][b] == 1 && q[1][b] == 1 && q[2][b] == 1 && q[3][b] == 1 && q[4][b] == 1 && q[5][b] == 1 && q[6][b] == 1 && q[7][b] == 1) {
                d = d + 1;
                qingkong(q[][]);
                b = 0;
            }
            b = b + 1;
        }
    }
}
